Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remember referenced repositories as system repositories instead of user #512

Merged
merged 1 commit into from
May 11, 2024

Conversation

laeubi
Copy link
Member

@laeubi laeubi commented May 11, 2024

Currently there is a quite surprising behavior, that if a user adds an
updatesite that contains a referenced repository, that after an
update-check additional repositories are visible. Even worse these are
now used additionally to check for updates and if they contain other
references these are also added and so on. This can result not only in a
long list of sites the user never has added and has no clue where they
are coming from but even pulling in unwanted or conflicting updates.

Before this change

Here is an example with the m2e update site (https://download.eclipse.org/technology/m2e/snapshots/latest/):

In the first step there is only this single site:
grafik

Now I go to Help > Check For Updates and after this completes I end up with the following list (10 sites):
grafik

Now I repeat and perform Help > Check For Updates and after this completes I end up with the following list (12 sites):
grafik

After this changes

This now distinguishes two cases:

  1. A repository is discovered by the RepositoryAction it is handled as a
    user added repository and becomes visible
  2. A repository is discovered by a reference in that case it is handled
    as a system repository and not becomes visible

that way the list of user visible repositories stay clean from
referenced repositories and unexpected side effects on update checks.

FYI @merks @HannesWell @jonahgraham

@laeubi laeubi changed the title Remember referenced repositories as system repositories instead of user Currently there is a quite surprising behavior, that if a user adds an updatesite that contains a referenced repository, that after an update-check additional repositories are visible. Even worse these are now used additionally to check for updates and if they contain other references these are also added and so on. This can result not only in a long list of sites the user never has added and has no clue where they are coming from but even pulling in unwanted or conflicting updates. This now distinguishes two cases: 1) A repository is discovered by the RepositoryAction it is handled as a user added repository and becomes visible 2) A repository is discovered by a reference in that case it is handled as a system repository and not becomes visible that way the list of user visible repositories stay clean from referenced repositories and unexpected side effects on update checks. Remember referenced repositories as system repositories instead of user May 11, 2024
@laeubi laeubi requested a review from merks May 11, 2024 06:37
Copy link

github-actions bot commented May 11, 2024

Test Results

  375 files  ±0    375 suites  ±0   41m 35s ⏱️ -55s
1 893 tests ±0  1 890 ✅ ±0  3 💤 ±0  0 ❌ ±0 
6 679 runs  ±0  6 670 ✅ ±0  9 💤 ±0  0 ❌ ±0 

Results for commit 6ac40fb. ± Comparison against base commit 4ed9c3e.

♻️ This comment has been updated with latest results.

@merks
Copy link
Contributor

merks commented May 11, 2024

I see that org.eclipse.equinox.internal.p2.updatechecker.UpdateChecker.checkForUpdates(String, IQuery) calls org.eclipse.equinox.internal.p2.updatechecker.UpdateChecker.getAvailableRepositories() which calls org.eclipse.equinox.p2.repository.IRepositoryManager.getKnownRepositories(int) with argument org.eclipse.equinox.p2.repository.IRepositoryManager.REPOSITORIES_ALL. As such, is accurate to conclude that not showing the repositories to the user actually has no impact on how Check for Updates will behave after the repo is added (discovered), regardless of whether the repo is marked system or not? If so, this change does not actually address the "Even worse..." aspect described in the first comment. If not, what am I overlooking?

It's rather disconcerting that there are repositories that will be contacted and used but you can't see , remove, nor disable them....

@laeubi
Copy link
Member Author

laeubi commented May 11, 2024

I can't tell much about UpdateChecker and it is possible that there are more issues lurking around, but this is about "Check For Updates" function in the IDE what uses UpdateHandler (!) and that one is defiantly consistent with the UI and calls it with flags = 2 (REPOSITORIES_NON_SYSTEM) I even verified with the debugger that there is no other call involved.

If one wants to see "everything" I'm sure the UI can be enhanced to support that use-case but this really focus on the part that I don't get new user repositories as a side effect of performing a check for updates.

@laeubi
Copy link
Member Author

laeubi commented May 11, 2024

A possible UI might look like this (or as part of the filter bar):

grafik

but as said that's nothing I'd like to address with this PR.

@merks
Copy link
Contributor

merks commented May 11, 2024

If you checked in the debugger then I’m reassured and this looks like a nice change. I had the same idea about a check box to show system repositories; it would help debug.

Copy link
Contributor

@merks merks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case someone/something relies on the old behavior, which I doubt, one might use a system property to specify true versus the default of false.

@laeubi
Copy link
Member Author

laeubi commented May 11, 2024

If such thing is required I think it should (again) be an UI thing so when I add the site I can select to also add references and maybe select what I want to have added.

@merks
Copy link
Contributor

merks commented May 11, 2024

It’s not required. It’s just a thought.

@laeubi laeubi force-pushed the rember_as_system branch 3 times, most recently from 77e4fb3 to 3199f3f Compare May 11, 2024 13:50
Currently there is a quite surprising behavior, that if a user adds an
updatesite that contains a referenced repository, that after an
update-check additional repositories are visible. Even worse these are
now used additionally to check for updates and if they contain other
references these are also added and so on. This can result not only in a
long list of sites the user never has added and has no clue where they
are coming from but even pulling in unwanted or conflicting updates.

This now distinguishes two cases:

1) A repository is discovered by the RepositoryAction it is handled as a
user added repository and becomes visible
2) A repository is discovered by a reference in that case it is handled
as a system repository and not becomes visible

that way the list of user visible repositories stay clean from
referenced repositories and unexpected side effects on update checks.
@laeubi
Copy link
Member Author

laeubi commented May 11, 2024

It’s not required. It’s just a thought.

I now added p2.metadata.repository.reference.system that defaults to true

@laeubi laeubi merged commit 0f3af2c into eclipse-equinox:master May 11, 2024
11 checks passed
@merks
Copy link
Contributor

merks commented May 11, 2024

Kudos for investing your time on these improvements! 🏅

@laeubi
Copy link
Member Author

laeubi commented May 12, 2024

No problem, this was an issue for too long now and seem to regularly cause confusions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants